package com.tencreat.mq;

import com.rabbitmq.client.Channel;
import com.tencreat.common.enums.QueueEnum;
import com.tencreat.service.system.impl.SysDictTypeServiceImpl;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.io.ByteArrayInputStream;
import java.io.ObjectInputStream;
import java.util.Objects;

/**
 * 描述信息
 *
 * @Author huang wei
 * @Company: 深圳腾创互联科技有限公司
 * @link: https://tencreat.com
 * @Date: 2022/4/13 17:11
 */
@Service
public class SysDictConsumer {

    @Resource
    private SysDictTypeServiceImpl sysDictTypeService;

    @RabbitListener(queues = "base-mall.system.reload.name")
    @Transactional(rollbackFor = Exception.class)
    public void doJob(Message message, Channel channel) throws Exception {
        long deliveryTag = message.getMessageProperties().getDeliveryTag();
        sysDictTypeService.init();
        channel.basicAck(deliveryTag,false);

    }
}
